package com.thd.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractNameValueGatewayFilterFactory;
import org.springframework.stereotype.Component;

@Component
public class KeyValueGatewayFilterFactory extends AbstractNameValueGatewayFilterFactory {
    private Logger logger = LoggerFactory.getLogger(KeyValueGatewayFilterFactory.class.getName());
    @Override
    public GatewayFilter apply(NameValueConfig config) {
        logger.info("自定义带参数的filter , name:{} , value:{}",config.getName(),config.getValue());
        return new KeyValueGatewayFilter(config.getName(),config.getValue());
    }
}
